package com.tlw.practice.tlw.utils;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateFormatUtil {
    public static Date format(Date date, String hour) throws ParseException {

        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, date.getYear());
        calendar.set(Calendar.MONTH, date.getMonth());
        calendar.set(Calendar.DATE, date.getDay());
        calendar.set(Calendar.HOUR, Integer.parseInt(hour));

        return calendar.getTime();
    }
}
